package com.aura.springbook.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Swagger配置类
 */
@Configuration
public class SwaggerConfig {

    /**
     * 自定义OpenAPI配置
     * <p>
     * 配置API文档的基本信息，包括标题、描述、版本、联系人和许可证
     *
     * @return OpenAPI配置对象
     */
    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .components(new Components())
                .info(new Info()
                        .title("图书借阅系统API文档")
                        .description("基于Spring Boot的图书借阅系统API接口文档")
                        .version("1.0")
                        .contact(new Contact()
                                .name("开发者")
                                .url("https://gitee.com/have-a-cup-of-java11")
                                .email("developer@example.com"))
                        .license(new License()
                                .name("Apache 2.0")
                                .url("http://www.apache.org/licenses/LICENSE-2.0.html")));
    }
}